﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master" AutoEventWireup="true"
    CodeBehind="AddressList.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.AddressList" %>
    <%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>收货地址</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">
    <div data-role="page" id="mypage">
        <!--S header -->
        <div data-role="header">
        </div>
        <!--S content -->
        <div role="main" class="ui-content">
            <div class="address" id="addressList">
            </div>
            <div class="address ADDress">
                <ul data-role="listview" data-inset="true">
                    <li><a href="AddressDetail.aspx" data-ajax="false">新增收货地址</a></li>
                </ul>
            </div>
        </div>
        <!--e pinpai_box-->
        <!--S footer -->
        <div data-role="footer" data-position="fixed" data-tap-toggle="false">
    
                <uc1:Footer ID="Footer1" runat="server" MenuId="M" />  
        </div>
        <!--E footer -->
    </div>
  <script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
    <script type="text/javascript">
        function removeAddress(addrid) {

            confirmDialog("请确认删除此地址信息", function () {
                var param = { AddressId: addrid, Owner: '<%= CurrentMemberAccount%>' };

                $(document).executeCommand({ successCallBack: function () {
                    showTips('操作成功！', 1000);
                    setTimeout(flushAddressList, 1000);
                }
                }, "Member.RemoveAddress", param);
            });
        }

        function flushAddressList() {
            var handler = $('#addressList').listviewHandler();
            handler.initialize({
                loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
                emptyHtml: '&nbsp;', //无记录时显示此html
                itemTemplate: '<div class="boxlist">'
                            + ' <div class="left"><a  onclick="removeAddress({Id});"><img src="images/cart_delete.png"></a>'
                            + ' </div>'
                            + ' <div class="center" >'
                            + ' <div class="text">{ProvinceName}{CityName}{AreaName}{Address}</div>'
                            + '<p>{Receiver}<Span>{Phone}</Span></p>'
                            + '</div>'
                            + ' <div class="right"><a  onclick="location.href=\'AddressDetail.aspx?addressId={Id}\'"><img src="images/bianji_icon.png"></a></div>'
                            + ' <div class="clear"></div>'
                            + '</div>', //项模板
                pageIndex: 1, //页码（从1起算）
                pageSize: 100, //页大小
                totalCount: 999, //总记录数
                itemHandler: function (data, itemTemplate, container) {//数据各项处理
                    if (data.Area == null) {
                        data.Area = '';
                    }
                    return itemTemplate.format(data);
                },
                command: 'Member.LoadAddressList',
                parameter: { MemberAccount: '<%=CurrentMemberAccount %>'  }
            });
            handler.nextPage();
        };
        $(function () {
            if (flushAddressList) {
                flushAddressList();
            }
        });
    </script>
</asp:Content>
